.TH pdbtool 1 "03 September 2025" 4.9.0 "The pdbtool manual page"
.SH NAME
.PP
pdbtool \-\-\- An application to test and convert {{ site.product.short_name }} pattern database rules
.SH Synopsis
.PP
pdbtool [command] [options]
.SH Description
.PP
This manual page is only an abstract.
.PP
The syslog\-ng OSE application can match the contents of the log messages
to a database of predefined message patterns (also called patterndb). By
comparing the messages to the known patterns, syslog\-ng OSE is able to
identify the exact type of the messages, tag the messages, and sort them
into message classes. The message classes can be used to classify the
type of the event described in the log message. The functionality of the
pattern database is similar to that of the logcheck project, but the
syslog\-ng OSE approach is faster, scales better, and is much easier to
maintain compared to the regular expressions of logcheck.
.PP
The pdbtool application is a utility that can be used to:
.RS
.IP \(bu 2
\fB\fCtest messages\fR, or \fB\fCspecific rules\fR
.IP \(bu 2
convert an older pattern database to the latest database format
.IP \(bu 2
\fB\fCmerge pattern databases\fR into a single file
.IP \(bu 2
\fB\fCautomatically create pattern databases\fR from a
large amount of log messages
.IP \(bu 2
\fB\fCdump the RADIX tree\fR built from the pattern database
(or a part of it) to explore how the pattern matching works.
.RE
.SH The dictionary command
.PP
dictionary [options]
.PP
Lists every name\-value pair that can be set by the rules of the pattern
database.
.RS
.IP \(bu 2
\-\-dump\-tag or \-T
.PP
List the tags instead of the names of the name\-value pairs.
.IP \(bu 2
\-\-pdb <path\-to\-file> or \-p <path\-to\-file>
.PP
Name of the pattern database file to use.
.IP \(bu 2
\-\-program <programname> or \-P <programname>
.PP
List only the name\-value pairs that can be set for the messages of
the specified ${PROGRAM} application.
.RE
.SH The dump command
.PP
dump [options]
.PP
Display the RADIX tree built from the patterns. This shows how are the
patterns represented in syslog\-ng OSE and it might also help to track
down pattern\-matching problems. The dump utility can dump the tree used
for matching the \fB\fCPROGRAM\fR or the \fB\fCMSG\fR parts.
.RS
.IP \(bu 2
\-\-debug or \-d
.PP
Enable debug/diagnostic messages on stderr.
.IP \(bu 2
\-\-pdb or \-p
.PP
Name of the pattern database file to use.
.IP \(bu 2
\-\-program or \-P
.PP
Displays the RADIX tree built from the patterns belonging to the
${PROGRAM} application.
.IP \(bu 2
\-\-program\-tree or \-T
.PP
Display the ${PROGRAM} tree.
.IP \(bu 2
\-\-verbose or \-v
.PP
Enable verbose messages on stderr.
.RE
.SS Example and sample output
.PP
.RS
.nf
pdbtool dump \-p patterndb.xml  \-P 'sshd'
.fi
.RE
.PP
.RS
.nf
\&'p'
    'assword for'
    @QSTRING:@
        'from'
        @QSTRING:@
            'port '
            @NUMBER:@ rule_id='fc49054e\-75fd\-11dd\-9bba\-001e6806451b'
                ' ssh' rule_id='fc55cf86\-75fd\-11dd\-9bba\-001e6806451b'
                    '2' rule_id='fc4b7982\-75fd\-11dd\-9bba\-001e6806451b'
    'ublickey for'
    @QSTRING:@
        'from'
        @QSTRING:@
            'port '
            @NUMBER:@ rule_id='fc4d377c\-75fd\-11dd\-9bba\-001e6806451b'
                ' ssh' rule_id='fc5441ac\-75fd\-11dd\-9bba\-001e6806451b'
                    '2' rule_id='fc44a9fe\-75fd\-11dd\-9bba\-001e6806451b'
.fi
.RE
.SH The match command
.PP
match [options]
.PP
Use the match command to test the rules in a pattern database. The
command tries to match the specified message against the patterns of the
database, evaluates the parsers of the pattern, and also displays which
part of the message was parsed successfully. The command returns with a
0 (success) or 1 (no match) return code and displays the following
information:
.RS
.IP \(bu 2
the class assigned to the message (that is, system, violation, and
so on),
.IP \(bu 2
the ID of the rule that matched the message, and
.IP \(bu 2
the values of the parsers (if there were parsers in the matching
pattern).
.RE
.PP
The match command has the following options:
.RS
.IP \(bu 2
\-\-color\-out or \-c
.PP
Color the terminal output to highlight the part of the message that
was successfully parsed.
.IP \(bu 2
\-\-debug or \-d
.PP
Enable debug/diagnostic messages on stderr.
.IP \(bu 2
\-\-debug\-csv or \-C
.PP
Print the debugging information returned by the \-\-debug\-pattern
option as comma\-separated values.
.IP \(bu 2
\-\-debug\-pattern or \-D
.PP
Print debugging information about the pattern matching. See also the
\-\-debug\-csv option.
.IP \(bu 2
\-\-file=<filename\-with\-path> or \-f
.PP
Process the messages of the specified log file with the pattern
database. This option allows to classify messages offline, and to
apply the pattern database to already existing logfiles. To read the
messages from the standard input (stdin), specify a hyphen (\-)
character instead of a filename.
.IP \(bu 2
\-\-filter=<filter\-expression> or \-F
.PP
Print only messages matching the specified syslog\-ng OSE filter
expression.
.IP \(bu 2
\-\-message or \-M
.PP
The text of the log message to match (only the \fB\fCMESSAGE\fR part
without the syslog headers).
.IP \(bu 2
\-\-pdb or \-p
.PP
Name of the pattern database file to use.
.IP \(bu 2
\-\-program or \-P
.PP
Name of the program to use, as contained in the \fB\fCPROGRAM\fR part of
the syslog message.
.IP \(bu 2
\-\-template=<template\-expression> or \-T
.PP
A syslog\-ng OSE template expression that is used to format the output
messages.
.IP \(bu 2
\-\-verbose or \-v
.PP
Enable verbose messages on stderr.
.RE
.SS Example \- check
.PP
The following command checks if the patterndb.xml file recognizes the
Accepted publickey for myuser from 127.0.0.1 port 59357 ssh6 message:
.PP
.RS
.nf
pdbtool match \-p patterndb.xml \-P sshd \-M "Accepted publickey for myuser from 127.0.0.1 port 59357 ssh6"
.fi
.RE
.SS Example \- apply
.PP
The following example applies the sshd.pdb pattern database file to the
log messages stored in the /var/log/messages file, and displays only the
messages that received a useracct tag.
.PP
.RS
.nf
pdbtool match \-p sshd.pdb \\
    –file /var/log/messages \\
    –filter ‘tags(“usracct”);’
.fi
.RE
.SH The merge command
.PP
merge [options]
.PP
Use the merge command to combine separate pattern database files into a
single file (pattern databases are usually stored in separate files per
applications to simplify maintenance). If a file uses an older database
format, it is automatically updated to the latest format (V3). See the
The syslog\-ng OSE Administrator Guide for
details on the different pattern database versions.
.RS
.IP \(bu 2
\-\-debug or \-d
.PP
Enable debug/diagnostic messages on stderr.
.IP \(bu 2
\-\-directory or \-D
.PP
The directory that contains the pattern database XML files to be
merged.
.IP \(bu 2
\-\-glob or \-G
.PP
Specify filenames to be merged using a glob pattern, for example,
using wildcards. For details on glob patterns, see man glob. This
pattern is applied only to the filenames, and not on directory
names.
.IP \(bu 2
\-\-pdb or \-p
.PP
Name of the output pattern database file.
.IP \(bu 2
\-\-recursive or \-r
.PP
Merge files from subdirectories as well.
.IP \(bu 2
\-\-sort or \-s
.PP
Sort files into alphabetic order during the merge (first sort by
filename, then by directory name).
.IP \(bu 2
\-\-verbose or \-v
.PP
Enable verbose messages on stderr.
.RE
.SS Example \- merge
.PP
.RS
.nf
pdbtool merge \-\-recursive \-\-directory /home/me/mypatterns/  \-\-pdb /var/lib/syslog\-ng/patterndb.xml
.fi
.RE
.PP
Currently it is not possible to convert a file without merging, so if
you only want to convert an older pattern database file to the latest
format, you have to copy it into an empty directory.
.SH The patternize command
.PP
patternize [options]
.PP
Automatically create a pattern database from a log file containing a
large number of log messages. The resulting pattern database is printed
to the standard output (stdout). The pdbtool patternize command uses a
data clustering technique to find similar log messages and replacing the
differing parts with @ESTRING:: @ parsers. For details on pattern
databases and message parsers, see the The syslog\-ng OSE Administrator Guide \[la]https://www.syslog-ng.com/\[ra]\&. The patternize command is available
only in version 3.2 and later.
.RS
.IP \(bu 2
\-\-debug or \-d
.PP
Enable debug/diagnostic messages on stderr.
.IP \(bu 2
\-\-file=<path> or \-f
.PP
The logfile containing the log messages to create patterns from. To
receive the log messages from the standard input (stdin), use \-.
.IP \(bu 2
\-\-iterate\-outliers or \-o
.PP
Recursively iterate on the log lines to cover as many log messages
with patterns as possible.
.IP \(bu 2
\-\-named\-parsers or \-n
.PP
The number of example log messages to include in the pattern
database for every pattern. Default value: 1
.IP \(bu 2
\-\-no\-parse or \-p
.PP
Do not parse the input file, treat every line as the message part of
a log message.
.IP \(bu 2
\-\-samples=<number\-of\-samples>
.PP
Include a generated name in the parsers, for example,
\fB\&.dict.string1\fP, \fB\&.dict.string2\fP, and so on.
.IP \(bu 2
\-\-support=<number> or \-S
.PP
A pattern is added to the output pattern database if at least the
specified percentage of log messages from the input logfile match
the pattern. For example, if the input logfile contains 1000 log
messages and the \-\-support=3.0 option is used, a pattern is created
only if the pattern matches at least 3 percent of the log messages
(that is, 30 log messages). If patternize does not create enough
patterns, try to decrease the support value.
.PP
Default value: 4.0
.IP \(bu 2
\-\-verbose or \-v
.PP
Enable verbose messages on stderr.
.RE
.SS Example \- patternize
.PP
.RS
.nf
pdbtool patternize \-\-support=2.5 \-\-file=/var/log/messages
.fi
.RE
.SH The test command
.PP
test [options]
.PP
Use the test command to validate a pattern database XML file. Note that
you must have the xmllint application installed. The test command is
available only in syslog\-ng OSE version 3.2 and later.
.RS
.IP \(bu 2
\-\-color\-out or \-c
.PP
Enable coloring in terminal output.
.IP \(bu 2
\-\-debug or \-d
.PP
Enable debug/diagnostic messages on stderr.
.IP \(bu 2
\-\-debug or \-D
.PP
Print debugging information on non\-matching patterns.
.IP \(bu 2
\-\-rule\-id or \-r
.PP
Test only the patterndb rule (specified by its rule id) against its
example.
.IP \(bu 2
\-\-validate
.PP
Validate a pattern database XML file.
.IP \(bu 2
\-\-verbose or \-v
.PP
Enable verbose messages on stderr.
.RE
.SS Example \- test
.PP
.RS
.nf
pdbtool test \-\-validate /home/me/mypatterndb.pdb
.fi
.RE
.SH Files
.PP
/opt/syslog\-ng/
.PP
/opt/syslog\-ng/etc/syslog\-ng.conf
.PP
\fBNOTE:\fP
If you experience any problems or need help with syslog\-ng OSE, see the \fIsyslog\-ng OSE Administration Guide\fP[1], or visit the \fIsyslog\-ng OSE mailing list\fP[2].
For news and notifications about syslog\-ng OSE, visit the \fIsyslog\-ng OSE blogs\fP[3].
.SH AUTHOR
.PP
This manual page was generated from the \fIsyslog\-ng OSE Administration Guide\fP[1], which was written by several contributors to whom we'd like to extend our sincere thanks.
.SH COPYRIGHT
.SH NOTES
.PP
[1] \fB\fCsyslog\-ng OSE Administration Guide\fR
    \[la]https://syslog-ng.github.io/admin-guide/README\[ra]
.PP
[2] \fB\fCsyslog\-ng OSE mailing list\fR
    \[la]https://lists.balabit.hu/mailman/listinfo/syslog-ng\[ra]
.PP
[3] \fB\fCsyslog\-ng OSE blogs\fR
    \[la]https://syslog-ng.com/blog/\[ra]
